package com.shiyi.shiyiaiagent.tools;

import org.springframework.ai.tool.ToolCallback;
import org.springframework.ai.tool.ToolCallbacks;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ToolRegistration {


  @Value("${search-api.api-key}")
  private String searchApiKey;

  @Bean
  public ToolCallback[] allTools() {
    FileOperationTool fileOperationTool = new FileOperationTool();
    PDFGenerationTool pdfGenerationTool = new PDFGenerationTool();
    ResourceDownloadTool resourceDownloadTool = new ResourceDownloadTool();
    TerminalOperationTool terminalOperationTool = new TerminalOperationTool();
    WebSearchTool webSearchTool = new WebSearchTool(searchApiKey);
    WebScrapingTool webScrapingTool = new WebScrapingTool();

    return ToolCallbacks.from(
      fileOperationTool,
      pdfGenerationTool,
      resourceDownloadTool,
      terminalOperationTool,
      webSearchTool,
      webScrapingTool
    );
  }
}
